package com.example.demo.controller;

import com.example.demo.model.DbTypes;
import com.example.demo.model.MapConfig;
import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/config")
public class ConfigController {
    @Value("${server.port}")
    private String port;

    @RequestMapping("/getPort")
    public String getPort(){
        return port;
    }

    @Value("${spring.application.name: }")
    private String name;

    @RequestMapping("/getName")
    public String getName(){
        return name;
    }

    @Autowired
    private Student student;

    @RequestMapping("/getStudent")
    public String getStudent(){
        return student.toString();
    }

    @Autowired
    private DbTypes dbTypes;

    @RequestMapping("/dbNames")
    public String dbNames(){
        return dbTypes.getName().toString();
    }

    @Autowired
    private MapConfig mapConfig;

    @RequestMapping("/getMap")
    public String getMap(){
        return mapConfig.getMap().toString();
    }
}
